<template>
  <HomeBook
    :row="(category.length / 2) + 1"
    :col="2"
    :data="category"
    mode="category"
    :showTitle="false"
    :showBtn="false"
    @onCategoryClick="onCategoryClick"
  ></HomeBook>
</template>

<script>
import HomeBook from '../../components/home/HomeBook'
import { getCategoryList } from '../../api/index'
export default {
  components: { HomeBook },
  mounted () {
    this.getCategoryList()
  },
  data () {
    return {
      category: []
    }
  },
  methods: {
    async getCategoryList () {
      const { data: { data } } = await getCategoryList()
      this.category = data
    },
    onCategoryClick (e) {
      // 在子组件上做页面跳转了，这个函数在这里已经没有用处
      console.log('categoryList-onCategoryClick')
      console.log(e)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>